import 'package:flutter/material.dart';

/*

*
void main() {
  return runApp(const Center(
    child: Text(
      '你好flutter',
      textDirection: TextDirection.rtl,
      style: TextStyle(
          // color: Color.fromARGB(a, r, g, b)
          // color: Color.fromRGBO(r, g, b, opacity)
          color: Colors.red,
          fontSize: 40),
    ),
  ));
}



*/

///所以得入口函数都是以MateriaApp为入口， home以Scaffold为入口
///
/*
*
void main() {
  return runApp(MaterialApp(
    title: '这是测试的app',
    home: Scaffold(
      appBar: AppBar(
        title: const Text('导航栏'),
      ),
      body: const Center(
          child: Column(
        children: [
          Text(
            'Flutter 你好',
            style: TextStyle(color: Colors.red),
          ),
        ],
      )),
    ),
  ));
}

*
* **/

/// 抽离后的最终办法实现

void main() {
  return runApp(const Myapp());
}

class Myapp extends StatelessWidget {
  const Myapp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: '标题',
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({super.key});

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('标题'),
      ),
      body: Center(
        child: Text('第一个打的fdf'),
      ),
    );
  }
}
